package org.wekit.engine.pvm.process;

import java.util.Properties;

import org.wekit.engine.pvm.PvmProcessElement;


/**
 * 流程基本元素定义
 * @author HuangWeili
 *
 */
public class ProcessElement implements PvmProcessElement {

	private static final long serialVersionUID = -7228394407092825240L;
	//元素标识
	protected String id;
	//流程定义
	protected ProcessDefinition processDefinition;
	//属性定义
	protected Properties properties;

	public ProcessElement(String id,ProcessDefinition processDefinition){
		this.id=id;
		this.processDefinition=processDefinition;
	}
	
	@Override
	public String getId() {
		// TODO Auto-generated method stub
		return this.id;
	}

	
	@Override
	public Object getProperty(String keyName) {
		// TODO Auto-generated method stub
		return this.properties.getProperty(keyName);
	}

	/**
	 * 获取定义的属性
	 * @return
	 */
	public Properties getProperties(){
		if(null==this.properties)
		{
			this.properties=new Properties();
		}
		return this.properties;
	}
	
	/**
	 * 设置属性
	 * @param properties
	 */
	public void setProperties(Properties properties){
		this.properties=properties;
	}
	
	/**
	 * 添加属性
	 * @param key
	 * @param value
	 */
	public void setProperty(String key,Object value){
		if(this.properties==null)
		{
			this.properties=new Properties();
		}
		this.properties.put(key, value);
	}
	
	@Override
	public ProcessDefinition getProcessDefinition() {
	
		return this.processDefinition;
	}

}
